package com.jwater.core.manager.master.event;

import com.jwater.core.serialize.SerializeUtils;

/**
 * @description:
 * @author: jnner
 * @createDate: 2021/3/6
 * @version: 1.0
 */
public class RepeatWorkerEvent extends GroupEvent {
    private String itemKey;
    private String host;

    public String getItemKey() {
        return itemKey;
    }

    public void setItemKey(String itemKey) {
        this.itemKey = itemKey;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    @Override
    public String getType() {
        return GroupEvent.TYPE_REPEAT_WORKER;
    }

    @Override
    public byte[] serialize() {
        return SerializeUtils.serializeArray(itemKey, host);
    }

    @Override
    public GroupEvent deserialize(byte[] data) {
        Object[] objs = SerializeUtils.deserializeArray(data);
        this.itemKey = (String) objs[0];
        this.host = (String) objs[1];
        return this;
    }
}
